# 代码编写者： 李朔
# 开发时间： 2021/9/10 15:42
chalk=[5,1,5]
k=22

def chalkReplacer(chalk,k):
    #先算出每轮会用到的粉笔总数
    chalk_sum=0
    for i in chalk:
        chalk_sum+=i
    # print(chalk_sum)
    remainder=k%chalk_sum
    # print(yushu)
    # for i in range(len(chalk)):
    #     remainder-=chalk[i]
    #     if remainder<0:
    #         return i
    i=0
    while i<len(chalk) and remainder>=0:
        remainder-=chalk[i]
        if remainder<0:
            return i
        i+=1
print(chalkReplacer(chalk,k))